package com.neuq.animaladoption.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.neuq.animaladoption.anno.AnimalState;
import com.neuq.animaladoption.anno.AnimalType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.groups.Default;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Animal {
    @NotNull(groups = Update.class)
    private Integer id;//主键ID
    @Pattern(regexp = "^.{0,30}$")
    private String animalName;//动物名字
    private Integer animalAge;//动物到收容所的时间
    @NotNull
    @AnimalType
    private String animalType;//种类
    private String variety;//品种
    @NotEmpty
    @URL
    private String animalPic;//照片地址
    @NotEmpty
    @AnimalState
    private String animalState = "未被收养";//动物状态
//    @NotNull
    private Integer shelterId = 1;//收容所ID
    private Integer createUser;//创建人ID
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;//创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;//更新时间

    public interface Add extends Default {}

    public interface Update extends Default {}
}